/**
 * 
 */
package com.agrec.client;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;

/**
 * @author allomeen
 *
 */
public class AGRecDialogBox extends DialogBox {

	private Widget widget;
	private VerticalPanel panel;

	public AGRecDialogBox(Widget widget) {
		this.widget = widget;
		init();
	}

	/**
	 * @param autoHide
	 */
	public AGRecDialogBox(boolean autoHide, Widget widget) {
		super(autoHide);
		this.widget = widget;
		init();
	}

	/**
	 * @param autoHide
	 * @param modal
	 */
	public AGRecDialogBox(boolean autoHide, boolean modal, Widget widget) {
		super(autoHide, modal);
		this.widget = widget;
		init();
	}

	private void init() {
		panel = new VerticalPanel();
		
		panel.add(this.widget);
		
		
		Button closeButton = new Button("Close",
		        new ClickHandler() {
		          public void onClick(ClickEvent event) {
		            hide();
		          }
		        });
		panel.add(closeButton);
		setWidget(panel);
		setAnimationEnabled(true);
		
	}

}
